<template>
  <div class="flex">
    <div>正在打开小程序...</div>
    <button class="open" @click="open">打开小程序</button>
  </div>
</template>

<script>
export default {
  name: 'openwx',
  data() {
    return {
      scheme: ''
    }
  },
  mounted() {
    console.log('this.$router', this.$route);
    const { scheme } = this.$route.query
    this.scheme = scheme
    // setTimeout(() => {
    //   location.href = this.scheme
    // }, 1000);
  },
  methods: {
    open() {
      location.href = this.scheme
    }
  }
};
</script>

<style>
.flex {
  display: flex;
  flex-direction: column;
  justify-content: center; /* 水平居中 */
  align-items: center; /* 垂直居中 */
  width: 100vw;
  height: 100vh;
}
.open {
  width: 200px;
  height: 50px;
  color: #fff;
  font-size: 20px;
  text-align: center;
  line-height: 50px;
  margin-top: 40px;
  border: none;
  border-radius: 8px;
  background: #04BE02;
}
</style>
